<template>
  <div class="home">
    <van-search
      v-model="SearchVal"
      shape="round"
      placeholder="请输入搜索关键词"
      disabled
      @click="$router.push('/searchPopup')"
    />

    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="red">
      <van-swipe-item v-for="item in banner" :key="item.id">
        <img :src="item.image_url" alt="" width="100%" />
      </van-swipe-item>
    </van-swipe>
    
    <transition name="van-slide-right">  
    <router-view></router-view>
  </transition> 
  </div>
</template>

<script>
import { GetHomeList } from "@/request/api";
export default {
  data() {
    return {
      SearchVal: "",
      banner: [],
    };
  },
  
  created() {
    GetHomeList()
      .then((res) => {
        // console.log(res.data.data.banner);
        this.banner = res.data.banner;
      })
      .catch((err) => {
        console.log(err);
      });
  },
};
</script>

<style lang="scss" scoped>
// .slide-enter,.slide-leave-to{
// // 过度开始之前的样式
// right: -100%;
// }

// .slide-enter-active{
// // 过渡属性
// transition: right 1s;
// }
// .slide-enter-to,.slide-leave{
// // 过渡结束之后的样式
// right: 0;
// }
</style>
